public class HomeWork06_05{
    public static void main(String[] args){
        int count = 0;
        for(int i = 1; i <= 4; i++){
            for(int j = 1; j <= 4; j++){
                for(int m = 1; m <= 4; m++){
                    for(int n = 1; n <= 4; n++){
                        if(i != j && i != m &&  i != n && j != m && j != n && m != n){
                            System.out.print(i+""+j+""+m+""+n+"\n");
                            ++count;
                        }
                    }
                }
            }
        }
        System.out.println("\n共" + count + "组");
    }
}